
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>个性留言板</title>

<link href="css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript"> 
$(function(){
	
	// 移到留言上可以删除,编辑-------------------------------------------
		$('#mian .list .onep').hover(function() {
			$(this).find('a').show();
			$(this).find('.edit_a').show();
			$(this).find('.content').addClass('content1');
		}, function() {
			$(this).find('a').hide();
			$(this).find('.edit_a').hide();
			$(this).find('.content').removeClass('content1');
		});

   // 留言方式的切换------------------------------------------------
		var c=1;
		$('.close').click(function(event) {
			if(c==1){
				$('#right').stop().animate({"top": 800+'px'},2000).parent().parent().find('#bottom_out').stop().animate({"bottom": 0+'px'},3000);
				c=0;
			}else{
				$('#right').stop().animate({"top": 50+'px'},2000).parent().parent().find('#bottom_out').stop().animate({"bottom": -120+'px'},3000);
				c=1;
			}
		});

	
	
})


</script>

</head>
<?php 
   session_start();
   if (isset($_SESSION['userinfo']))
   {
       $login=true;
       $userinfo=$_SESSION['userinfo'];
   }
    else {
    echo "<script language='javascript'>";
    echo "alert('您还没登录，请先登录！');";
    echo "window.location.href='login.php';";
    echo "</script>";
    die;
   }
?>
<body>
<div id="top">
		<h1>个性留言板</h1>
</div>
<?php include 'db.php';
$result->free();
$db->close();
?>
<div id="mian_out">
	  <div id="mian">
               <form action="" method="get">
                   <input type="text" placeholder="请输入搜索关键字"  value="<?php echo $search; ?>" name="search"/>
                   <input type='submit' value="搜索" />
               </form>
			<h2>一共有<?php echo $gg ?>条</h2>
                        <?php foreach ($rows as $key) {
                              
                          ?>
			<ul class="list">
      					<li class="onep">
                                            <p class="pic"><img src="<?php echo $key["imgurl"] ?>" alt="" /></p>
					<p class="name"><?php echo $key["username"] ?></p>
					<p class="content"><?php echo $key["message"] ?>                    <span> (来自火星"<?php echo $key["sex"] ?>侠"的留言)</span><?php echo $key["m_date"] ?>
					</p>
					<a class="edit_a" href="javascript:" onclick="if(confirm('确定删除吗？')) location.href='bbs.php?id=<?php echo $key["id"] ?>'" >修改</a>
					<a class="delete" href="javascript:" onclick="if(confirm('确定删除吗？')) location.href='bbsDel.php?id=<?php echo $key["id"] ?>'" >删除</a>
				</li>
                                
				        </ul>
                        <?php } ?>
                         </ul>
                <ul id="gg">
                    <?php 
                      $shang=(($pg-1)<=0)?1:($pg-1);
                      $xi=(($pg+1)>$wei)?$wei:($pg+1);
                    ?>
                    
                    <li><a href="index.php?pg=1">首页</a></li>
                    <li><a href="index.php?pg=<?php echo $shang ?>">上一页</a></li>
                    <li><a href="index.php?pg=<?php echo $xi ?>">下一页</a></li>
                    <li class="last"><a href="index.php?pg=<?php echo $wei ?>">尾页</a></li>
                    <li>当前第<?php echo $pg ?>页/共<?php echo $wei ?>页</li>
                </ul>
   </div>
   
   <div id="right">
			<h2>留下你的脚步吧</h2>
			<form action="bbsadd.php" method="post">
				<p class="one">
				昵称:<input class="name" name="username" type="text" placeholder="你的名字" />
				<input type="radio" name="sex" value="男" checked="checked" />男侠
				<input type="radio" name="sex" value="女" />女侠
				</p>
				<p><textarea name="message" placeholder="这个人很懒,什么都没有写" ></textarea></p>
				<p class="tow">
					<input type="radio" name="imgurl" value="images/1.jpg" checked="checked" /><img src=" images/1.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/2.jpg" /><img src=" images/2.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/3.jpg" /><img src=" images/3.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/4.jpg" /><img src=" images/4.jpg" alt="" />
				</p>
				<p class="thr"><input class="btn" type="submit" value="提交" /></p>
			</form>
			<div class="close"></div>
</div>
   
</div>

<div id="bottom_out">
		<div id="bottom">
			<form action="upadd.php" method="post">
				<p class="one">
				昵称:<input class="name" name="username" type="text" placeholder="你的名字" />
				<br/><br/>
				<input type="radio" name="sex" value="男" checked="checked" />男侠
				<input type="radio" name="sex" value="女" />女侠
				</p>
				<p><textarea name="message" placeholder="这个人很懒,什么都没有写" ></textarea></p>
				<p class="tow">
					<input type="radio" name="imgurl" value="images/1.jpg" checked="checked" /><img src=" images/1.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/2.jpg" /><img src=" images/2.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/3.jpg" /><img src=" images/3.jpg" alt="" />
					<input type="radio" name="imgurl" value="images/4.jpg" /><img src=" images/4.jpg" alt="" />
				</p>
				<p class="thr"><input class="btn" type="submit" value="提交" /></p>
			</form>
			<div class="close"></div>
		</div>
</div>

</body>
</html>
